251991
@@ -569,7 +569,7 @@
protected void createBucketFiles(FSPaths fsp) throws HiveException {
       assert filesIdx == numFiles;
 
       // in recent hadoop versions, use deleteOnExit to clean tmp files.
-      if (isNativeTable) {
+      if (isNativeTable && fs != null && fsp != null) {
         autoDelete = fs.deleteOnExit(fsp.outPaths[0]);
       }
     } catch (Exception e) {
